﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace QL_NOI_TRU
{
    public partial class frmNhapDsDVCLS : DevExpress.XtraEditors.XtraForm
    {
        public frmNhapDsDVCLS()
        {
            InitializeComponent();
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            string strr = "EXEC Insert_DV_CAN_LAM_SANG @MADV = '" + txtMADV.Text.ToString().Trim() + "',@TENDV = '" + txtTenDV.Text.ToString().Trim() + "',@DGIA = '" + txtGia.Text.ToString().Trim() + "',@NGAYXD = '" + cbbNgayXN.Text.ToString() + "'";
            var kn = new Ketnoi(frmDangnhap.stringConn);
            kn.ExcuteQuery(strr);
          //  MessageBox.Show("Đã lưu thành công");
            btRefreshGia_Click(null, null);
        }

        private void frmNhapDsDVCLS_Load(object sender, EventArgs e)
        {
            var kn = new Ketnoi(frmDangnhap.stringConn);
            gridControl1.DataSource = kn.ExcuteQuery("select DV_CAN_LAM_SANG.MADV as 'Mã dịch vụ',TENDV as 'Tên dịch vụ',DONGIA.DGIA as 'Đơn giá',DONGIA.NGAYXD as 'Ngày xác định đơn giá' from DV_CAN_LAM_SANG,DONGIA where DONGIA.MADV = DV_CAN_LAM_SANG.MADV ");
        }

        private void btRefreshGia_Click(object sender, EventArgs e)
        {
            txtMADV.Text = "";
            txtTenDV.Text = "";
            txtGia.Text = "";
            cbbNgayXN.Text = "";
            frmNhapDsDVCLS_Load(null, null);
        }
    }
}